﻿@{ViewBag.Title = "Paging";}
@section CssImport{<link href="@Url.Content("~/Scripts/validationEngine/validationEngine.jquery.css")" rel="stylesheet" type="text/css" />}
@section JavascriptImport{
<script type="text/javascript" src="@Url.Content("~/Scripts/validationEngine/jquery.validationEngine.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/validationEngine/jquery.validationEngine-en.js")"></script>}
<div class="filtering"><form>
<label>Introduzca texto para filtrar: <input type="text" name="filter" id="filter" /></label>
<button type="submit" id="LoadRecordsButton" class="button medium orange" >Buscar Coincidencias</button>
</form></div>
<div id="MyTableContainer"></div>
<script type="text/javascript">
    $(document).ready(function () {
        $('#MyTableContainer').jtable({
            title: 'AIT_SolicitudEquipo',
            paging: true,
            pageSize: 20,
            sorting: true,
            defaultSorting: 'Id ASC',
            actions: {
                listAction: '@Url.Action("JSONPagedListByFilter")',
            },
            fields:
         {
             Id: {
                 key: true,
                 list: false
             }
             ,
             FechaSolicitud: {
                 title: 'FechaSolicitud',
                 list: true,
                 type: 'date',
                 displayFormat: 'dd-mm-yy',
                 sorting: false
             }
             ,
             FechaEntrega: {
                 title: 'FechaEntrega',
                 list: true,
                 type: 'date',
                 displayFormat: 'dd-mm-yy',
                 sorting: false
             }
             ,
             GuidSolicitante: {
                 type: 'hidden'
             }
             ,
             SolicitadoPor: {
                 title: 'SolicitadoPor',
                 list: true,
                 sorting: false
             }
             ,
             EntregadoPor: {
                 title: 'EntregadoPor',
                 list: true,
                 sorting: false
             }
             ,
             Descripcion: {
                 title: 'Descripcion',
                 list: true,
                 sorting: false
             }
             ,
             TipoConfiguracionId_FK: {
                 title: 'AIT_TipoConfiguracion',
                 list: true,
                 options: '@Url.Action("../AIT_TipoConfiguracion/JSONGetElementsForDropDownList")'
             }
         },
            formCreated: function (event, data) { data.form.validationEngine(); },
            formSubmitting: function (event, data) { return data.form.validationEngine('validate'); },
            formClosed: function (event, data) { data.form.validationEngine('hide'); data.form.validationEngine('detach'); }
        });
        $('#LoadRecordsButton').click(function (e) { e.preventDefault(); $('#MyTableContainer').jtable('load', { filter: $('#filter').val() }); });
        $('#LoadRecordsButton').click();
    });
</script>